home *** CD-ROM | disk | FTP | other *** search
- /*
- ** CTCPDriver.h
- **
- ** TurboTCP support library
- ** TCP driver interface class
- **
- ** Copyright © 1993, FrostByte Design / Eric Scouten
- */
-
-
- #pragma once
-
- #ifndef TurboTCPHeaders
- #include <CObject.h>
- #include <CCluster.h>
- #include <MacTCPCommonTypes.h>
- #include <OSUtils.h>
- #include "TurboTCP.const.h"
- #endif
-
- CLASS CTCPAsyncCall;
- CLASS CTCPDriver;
- CLASS CTCPStream;
- CLASS CTCPResolverCall;
-
-
- // global reference to TCP driver
-
- #ifndef CTCPDriverNoGlobal
- extern CTCPDriver *gTCPDriver; // TCP driver object (this object)
- #endif
-
-
- /*______________________________________________________________________
- **
- ** CTCPDriver
- **
- ** This object performs all of the housekeeping associated with the MacTCP driver.
- ** It keeps track of all currently open streams and handles the delayed-processing of
- ** MacTCP completions and notifications. It is also responsible for seeing that MacTCP is
- ** in a stable state (i.e. no streams left open, DNR closed) before the application quits.
- **
- */
-
-
- class CTCPDriver : public CObject {
-
- // TCP driver availability information
-
- protected:
- Boolean hasMacTCP; // is there a MacTCP driver available?
- Boolean hasResolver; // is the DNR code segment available?
- short myTCPRefNum; // MacTCP driver’s ioRefNum
- ip_addr myIPAddress; // our IP address
-
- // list of active streams/resolvers
-
- CCluster *activeStreamList; // list of active TCP streams
- CCluster *activeResolverList; // list of active DNR calls
-
- // interrupt-process queue
-
- public:
- QHdr asyncQueue; // interrupt-event queue
-
-
- // construction/destruction
-
- public:
- void ITCPDriver (Boolean doOpenResolver);
- void Dispose (void);
-
-
- // event handling
-
- void ProcessNetEvents (void);
-
-
- // ensure that TCP/DNR are present
-
- public:
- Boolean CheckTCPDriver (void);
- Boolean CheckResolver (void);
-
-
- // get TCP driver numbers
-
- short GetTCPRefNum (void);
- ip_addr GetIPAddr (void);
- protected:
- void FetchIPAddr (void);
-
-
- // tracking active streams/resolvers
-
- public:
- void RegisterActiveStream (CTCPStream *theStream);
- void RegisterActiveResolver (CTCPResolverCall *theResolver);
- void RemoveActiveStream (CTCPStream *theStream);
- void RemoveActiveResolver (CTCPResolverCall *theResolver);
- Boolean CheckResolverLimit (void);
-
- };
-